/**
 * MainActivity
 * 
 * 28/12/2013
 * 
 * Copyright GPL
 */
package com.jtmproject;

import android.os.Bundle;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.jtmproject.bluetooth.Client;
import com.jtmproject.bluetooth.Server;

/**
 * This activity charges the game
 * 
 * @author Javier Tejedor
 */
public class GameActivity extends AndroidApplication {

	public static final String TYPE_GAMER = "type_gamer";

	/* (non-Javadoc)
	 * @see android.app.Activity#onCreate(android.os.Bundle)
	 */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		Bundle extras = getIntent().getExtras();
		
		int typeGame = PongGame.NOT_ONLINE;

		if(extras != null){
			typeGame = extras.getInt(TYPE_GAMER);
		}
		
		AndroidApplicationConfiguration cfg = 
				new AndroidApplicationConfiguration();
		
		cfg.useGL20 = false;

		switch (typeGame) {
		case PongGame.SERVER:

			Server server = Server.getServer();
			initialize(new PongGame(server), cfg);

			break;

		case PongGame.CLIENT:

			Client client = Client.getClient();
			initialize(new PongGame(client), cfg);

			break;

		case PongGame.NOT_ONLINE:
			
			initialize(new PongGame(), cfg);
			
			break;

		default:
			break;
		}
	}

}